# -*- coding: utf-8 -*-
__author__ = 'alindar'
__date__ = '2018/7/11/011 22:18'
import xadmin
from .models import EmailVerifyRecord, Banner
from xadmin import views


# 开启自定义主题样式
class BaseSetting(object):
    # 主题功能开启
    enable_themes = True
    use_bootswatch = True


# 自定义tile foot
class GlobalSetting(object):
    site_title = "后台管理系统"
    site_footer = "后台管理系统"
    # 左侧导航模块 收缩起来
    menu_style = "accordion"


class EmailVerifyRecordAdmin(object):
    # 配置后台我们需要显示的列
    list_display = ['code', 'email', 'send_type', 'send_time']
    # 配置搜索字段,不做时间搜索
    search_fields = ['code', 'email', 'send_type']
    # 配置筛选字段
    list_filter = ['code', 'email', 'send_type', 'send_time']


class BannerAdmin(object):
    list_display = ['title', 'image', 'url', 'index', 'add_time']
    search_fields = ['title', 'image', 'url', 'index']
    list_filter = ['title', 'image', 'url', 'index', 'add_time']


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSetting)
